Spaces:
Build error
Build error
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from gradio_client import Client
|
| 2 |
+
|
| 3 |
+
# Initialize the client and set the API endpoint URL
|
| 4 |
+
client = Client("https://stabilityai-stablelm-tuned-alpha-chat.hf.space/")
|
| 5 |
+
client.predict(
|
| 6 |
+
fn_index=5
|
| 7 |
+
)
|
| 8 |
+
file1 = client.predict(fn_index=6)
|
| 9 |
+
# Send a "start" message to begin the conversation
|
| 10 |
+
result = client.predict("start", file1, fn_index=0)
|
| 11 |
+
conversation_id = result[1]
|
| 12 |
+
|
| 13 |
+
# Send a chat message and get the response
|
| 14 |
+
while True:
|
| 15 |
+
message = input("You: ")
|
| 16 |
+
result = client.predict(message, conversation_id, fn_index=2)
|
| 17 |
+
print("Bot:", open(result[1],'r').read())
|