Refactor FastAPI and Gradio integration by commenting out the old server launch code and clarifying the server port usage in the Gradio interface.
Browse files- api/fastapi_server.py +2 -2
- app.py +3 -3
api/fastapi_server.py
CHANGED
|
@@ -478,5 +478,5 @@ async def startup_event():
|
|
| 478 |
print(f"Warning: Failed to preload embeddings: {e}")
|
| 479 |
|
| 480 |
# Run the application
|
| 481 |
-
if __name__ == "__main__":
|
| 482 |
-
|
|
|
|
| 478 |
print(f"Warning: Failed to preload embeddings: {e}")
|
| 479 |
|
| 480 |
# Run the application
|
| 481 |
+
#if __name__ == "__main__":
|
| 482 |
+
# uvicorn.run("app:app", host="0.0.0.0", port=7860)
|
app.py
CHANGED
|
@@ -133,7 +133,8 @@ def clear_history():
|
|
| 133 |
return [], None # Returns empty history and resets conversation ID
|
| 134 |
|
| 135 |
# Create the Gradio interface
|
| 136 |
-
|
|
|
|
| 137 |
# Add conversation_id state first
|
| 138 |
conversation_id = gr.State(None)
|
| 139 |
|
|
@@ -190,7 +191,6 @@ if __name__ == "__main__":
|
|
| 190 |
# Launch Gradio interface
|
| 191 |
demo.launch(
|
| 192 |
server_name="0.0.0.0",
|
| 193 |
-
server_port=7861, #
|
| 194 |
share=False
|
| 195 |
-
)
|
| 196 |
#demo.launch(server_name="0.0.0.0", server_port=7860, share=False)
|
|
|
|
| 133 |
return [], None # Returns empty history and resets conversation ID
|
| 134 |
|
| 135 |
# Create the Gradio interface
|
| 136 |
+
demo = gr.Blocks(title="Status Law Assistant", theme=gr.themes.Soft())
|
| 137 |
+
with demo:
|
| 138 |
# Add conversation_id state first
|
| 139 |
conversation_id = gr.State(None)
|
| 140 |
|
|
|
|
| 191 |
# Launch Gradio interface
|
| 192 |
demo.launch(
|
| 193 |
server_name="0.0.0.0",
|
| 194 |
+
server_port=7861, # Using different port from FastAPI
|
| 195 |
share=False
|
|
|
|
| 196 |
#demo.launch(server_name="0.0.0.0", server_port=7860, share=False)
|