Spaces:
Sleeping
Sleeping
dongyubin
commited on
Commit
·
ec43c4f
1
Parent(s):
4f05ca4
更新
Browse files
app.py
CHANGED
@@ -36,15 +36,17 @@ def main():
|
|
36 |
文章要点""")
|
37 |
return response
|
38 |
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
inputs += [input_api_key, input_api_base]
|
45 |
|
46 |
-
|
47 |
-
|
|
|
|
|
|
|
48 |
|
49 |
|
50 |
if __name__ == '__main__':
|
|
|
36 |
文章要点""")
|
37 |
return response
|
38 |
|
39 |
+
def get_inputs(enabled):
|
40 |
+
if enabled:
|
41 |
+
return [input_api_key, input_api_base]
|
42 |
+
else:
|
43 |
+
return [input_url]
|
|
|
44 |
|
45 |
+
inputs = [input_checkbox] + get_inputs(input_checkbox.value)
|
46 |
+
outputs = "text"
|
47 |
+
update_interface = lambda enabled: gr.Interface(fn=my_inference_function, inputs=get_inputs(enabled), outputs=outputs)
|
48 |
+
interface = gr.Interface(fn=my_inference_function, inputs=inputs, outputs=outputs, examples=[["enabled", "api_key", "api_base", "url"]], title="ChatGPT")
|
49 |
+
interface.launch()
|
50 |
|
51 |
|
52 |
if __name__ == '__main__':
|