Futuresony commited on
Commit
20e9781
·
verified ·
1 Parent(s): f3a95e7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -35
app.py CHANGED
@@ -645,38 +645,4 @@ Available: {match.get('Available', 'N/A')}"""
645
  # This return statement MUST be inside the respond function definition
646
  return "", chat_history # Return empty string for the input box, and the updated history
647
 
648
- # --- Gradio Interface ---
649
-
650
- # Gradio will run this interface
651
- # The `chatbot` element will manage the chat history state automatically
652
- with gr.Blocks() as demo:
653
- # Display the model ID in the title for clarity
654
- gr.Markdown(f"# Business Q&A Assistant with {model_id}")
655
- gr.Markdown("Ask questions about the business (details from Google Sheet) or general knowledge (via search).")
656
-
657
- # The Chatbot component to display the conversation history
658
- chatbot = gr.Chatbot(height=400) # height in pixels
659
-
660
- # The Textbox component for user input
661
- msg = gr.Textbox(label="Your Question")
662
-
663
- # The Clear button to clear the input and chatbot history
664
- clear = gr.ClearButton([msg, chatbot])
665
-
666
- # The submit event: when the user presses Enter in the textbox or clicks the send button
667
- # - fn: The Python function to call (our respond function)
668
- # - inputs: A list of Gradio components whose values should be passed as arguments to the fn.
669
- # [msg] passes the user's input from the textbox.
670
- # [chatbot] passes the current state of the chatbot history.
671
- # - outputs: A list of Gradio components that should be updated with the values returned by the fn.
672
- # [msg] is updated with the first return value (intended to clear the textbox with "").
673
- # [chatbot] is updated with the second return value (the updated chat history).
674
- msg.submit(fn=respond, inputs=[msg, chatbot], outputs=[msg, chatbot])
675
-
676
- # Launch the Gradio app
677
- # share=True creates a public link (useful for testing, disable for private apps) - Use with caution.
678
- # enable_queue=True can help handle multiple users by queuing requests.
679
- if __name__ == "__main__":
680
- print("Launching Gradio app...")
681
- # Use server_name="0.0.0.0" and server_port=7860 for Hugging Face Spaces default deployment
682
- demo.launch(server_name="0.0.0.0", server_port=7860)
 
645
  # This return statement MUST be inside the respond function definition
646
  return "", chat_history # Return empty string for the input box, and the updated history
647
 
648
+ # --