Spaces:
Sleeping
Sleeping
Julian Vanecek commited on
Commit ·
cb292fb
1
Parent(s): 7b363cb
Create minimal Gradio app for testing
Browse files- Remove all complex dependencies
- Create simple echo chatbot
- Use only gradio==4.19.2
- Test basic HuggingFace deployment
- app.py +22 -10
- requirements.txt +1 -18
app.py
CHANGED
|
@@ -1,18 +1,30 @@
|
|
| 1 |
"""
|
| 2 |
-
|
| 3 |
"""
|
| 4 |
-
|
| 5 |
-
import sys
|
| 6 |
import os
|
| 7 |
|
| 8 |
-
|
| 9 |
-
|
|
|
|
|
|
|
| 10 |
|
| 11 |
-
#
|
| 12 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
|
| 14 |
if __name__ == "__main__":
|
| 15 |
-
# Create and launch the Gradio interface
|
| 16 |
-
demo = create_gradio_interface()
|
| 17 |
-
# Use Gradio's default launch settings for HuggingFace Spaces
|
| 18 |
demo.launch()
|
|
|
|
| 1 |
"""
|
| 2 |
+
Minimal Gradio app for HuggingFace Spaces
|
| 3 |
"""
|
| 4 |
+
import gradio as gr
|
|
|
|
| 5 |
import os
|
| 6 |
|
| 7 |
+
def chat_function(message, history):
|
| 8 |
+
"""Simple chat function that echoes the message"""
|
| 9 |
+
response = f"I received your message: '{message}'. This is a test deployment."
|
| 10 |
+
return response
|
| 11 |
|
| 12 |
+
# Create interface
|
| 13 |
+
with gr.Blocks() as demo:
|
| 14 |
+
gr.Markdown("# AI Assistant Multi-Agent System")
|
| 15 |
+
gr.Markdown("This is a simplified version for testing HuggingFace deployment.")
|
| 16 |
+
|
| 17 |
+
chatbot = gr.Chatbot()
|
| 18 |
+
msg = gr.Textbox()
|
| 19 |
+
clear = gr.Button("Clear")
|
| 20 |
+
|
| 21 |
+
def respond(message, chat_history):
|
| 22 |
+
bot_message = chat_function(message, chat_history)
|
| 23 |
+
chat_history.append((message, bot_message))
|
| 24 |
+
return "", chat_history
|
| 25 |
+
|
| 26 |
+
msg.submit(respond, [msg, chatbot], [msg, chatbot])
|
| 27 |
+
clear.click(lambda: None, None, chatbot, queue=False)
|
| 28 |
|
| 29 |
if __name__ == "__main__":
|
|
|
|
|
|
|
|
|
|
| 30 |
demo.launch()
|
requirements.txt
CHANGED
|
@@ -1,19 +1,2 @@
|
|
| 1 |
# Core dependencies
|
| 2 |
-
gradio==4.19.2
|
| 3 |
-
openai
|
| 4 |
-
tiktoken
|
| 5 |
-
|
| 6 |
-
# LangChain
|
| 7 |
-
langchain
|
| 8 |
-
langchain-openai
|
| 9 |
-
langchain-community
|
| 10 |
-
|
| 11 |
-
# Vector operations
|
| 12 |
-
numpy
|
| 13 |
-
|
| 14 |
-
# Utilities
|
| 15 |
-
python-dotenv
|
| 16 |
-
pydantic
|
| 17 |
-
pydantic-settings
|
| 18 |
-
SQLAlchemy
|
| 19 |
-
PyYAML
|
|
|
|
| 1 |
# Core dependencies
|
| 2 |
+
gradio==4.19.2
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|