Update app.py
Browse files
app.py
CHANGED
@@ -680,6 +680,14 @@ def http_api_infer(question: str, request: gr.Request):
|
|
680 |
return f"❌ Error: {str(e)}"
|
681 |
|
682 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
683 |
if __name__ == "__main__":
|
684 |
parser = argparse.ArgumentParser()
|
685 |
parser.add_argument("--host", type=str, default="0.0.0.0")
|
@@ -693,12 +701,7 @@ if __name__ == "__main__":
|
|
693 |
# Build main UI and API endpoint interface
|
694 |
ui_demo = build_demo()
|
695 |
|
696 |
-
|
697 |
-
fn=http_api_infer,
|
698 |
-
inputs=[gr.Textbox(label="Question")],
|
699 |
-
outputs="text",
|
700 |
-
api_name="/chat"
|
701 |
-
)
|
702 |
|
703 |
|
704 |
# Serve both under tabs — API tab will be invisible in browser but callable
|
|
|
680 |
return f"❌ Error: {str(e)}"
|
681 |
|
682 |
|
683 |
+
|
684 |
+
api_interface = gr.Interface(
|
685 |
+
fn=http_api_infer,
|
686 |
+
inputs=[gr.Textbox(label="Question")],
|
687 |
+
outputs="text",
|
688 |
+
api_name="/chat"
|
689 |
+
)
|
690 |
+
|
691 |
if __name__ == "__main__":
|
692 |
parser = argparse.ArgumentParser()
|
693 |
parser.add_argument("--host", type=str, default="0.0.0.0")
|
|
|
701 |
# Build main UI and API endpoint interface
|
702 |
ui_demo = build_demo()
|
703 |
|
704 |
+
|
|
|
|
|
|
|
|
|
|
|
705 |
|
706 |
|
707 |
# Serve both under tabs — API tab will be invisible in browser but callable
|