Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
@@ -10,8 +10,8 @@ import asyncio # Import asyncio for async operations
|
|
10 |
# Connect to your hosted Gradio Space (Futuresony/Mr.Events)
|
11 |
# This client is used by BOTH the /chat and /webhook endpoints to interact with the core chatbot
|
12 |
try:
|
13 |
-
client = Client("Futuresony/
|
14 |
-
print("Gradio Client for 'Futuresony/
|
15 |
except Exception as e:
|
16 |
print(f"Error initializing Gradio Client for 'Futuresony/Mr.Events': {e}")
|
17 |
print("Ensure the Space name is correct and it is accessible.")
|
@@ -74,7 +74,7 @@ async def chat(request: Request):
|
|
74 |
# Use the same VALID_API_KEY for the hosted space call
|
75 |
result = await client.predict( # Use await because client.predict can be async
|
76 |
query=user_message,
|
77 |
-
chat_history=chat_history, #
|
78 |
api_key=VALID_API_KEY, # Pass the APP_API_KEY to the hosted space
|
79 |
api_name="/chat" # Ensure this matches the API endpoint exposed by the hosted Gradio app
|
80 |
)
|
@@ -149,7 +149,7 @@ async def webhook(
|
|
149 |
# Gradio client expects query (current message) and chat_history (history *before* current turn)
|
150 |
result = await client.predict( # Use await
|
151 |
query=incoming_message,
|
152 |
-
chat_history=chat_history, #
|
153 |
api_key=VALID_API_KEY, # Pass the APP_API_KEY to the hosted space
|
154 |
api_name="/chat" # Ensure this matches the API endpoint exposed by the hosted Gradio app
|
155 |
)
|
@@ -200,4 +200,4 @@ if __name__ == "__main__":
|
|
200 |
|
201 |
|
202 |
print("Starting FastAPI application with Uvicorn...")
|
203 |
-
uvicorn.run(app, host="0.0.0.0", port=7860) # HF default port
|
|
|
10 |
# Connect to your hosted Gradio Space (Futuresony/Mr.Events)
|
11 |
# This client is used by BOTH the /chat and /webhook endpoints to interact with the core chatbot
|
12 |
try:
|
13 |
+
client = Client("Futuresony/ABSA_Test_Space")
|
14 |
+
print("Gradio Client for 'Futuresony/ABSA_Test_Space' initialized.")
|
15 |
except Exception as e:
|
16 |
print(f"Error initializing Gradio Client for 'Futuresony/Mr.Events': {e}")
|
17 |
print("Ensure the Space name is correct and it is accessible.")
|
|
|
74 |
# Use the same VALID_API_KEY for the hosted space call
|
75 |
result = await client.predict( # Use await because client.predict can be async
|
76 |
query=user_message,
|
77 |
+
# chat_history=chat_history, # Remove chat_history parameter
|
78 |
api_key=VALID_API_KEY, # Pass the APP_API_KEY to the hosted space
|
79 |
api_name="/chat" # Ensure this matches the API endpoint exposed by the hosted Gradio app
|
80 |
)
|
|
|
149 |
# Gradio client expects query (current message) and chat_history (history *before* current turn)
|
150 |
result = await client.predict( # Use await
|
151 |
query=incoming_message,
|
152 |
+
# chat_history=chat_history, # Remove chat_history parameter
|
153 |
api_key=VALID_API_KEY, # Pass the APP_API_KEY to the hosted space
|
154 |
api_name="/chat" # Ensure this matches the API endpoint exposed by the hosted Gradio app
|
155 |
)
|
|
|
200 |
|
201 |
|
202 |
print("Starting FastAPI application with Uvicorn...")
|
203 |
+
uvicorn.run(app, host="0.0.0.0", port=7860) # HF default port
|