Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,15 +1,11 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
import requests
|
| 3 |
|
| 4 |
-
def interact_with_server(prompt,
|
| 5 |
server_url = "http://xzyorb.servemp3.com:80"
|
| 6 |
response = requests.post(server_url, data={"prompt": prompt})
|
| 7 |
response_text = response.text
|
| 8 |
|
| 9 |
-
# Extract IP address and user agent from the request object
|
| 10 |
-
ip_address = request.remote_addr
|
| 11 |
-
user_agent = request.user_agent.string
|
| 12 |
-
|
| 13 |
# Count the number of messages in the conversation
|
| 14 |
conversation_messages = response_text.split("<br>") # Assuming each message is separated by "<br>"
|
| 15 |
num_messages = len(conversation_messages)
|
|
@@ -23,7 +19,7 @@ def interact_with_server(prompt, request):
|
|
| 23 |
|
| 24 |
iface = gr.Interface(
|
| 25 |
fn=interact_with_server,
|
| 26 |
-
inputs=gr.inputs.Textbox(),
|
| 27 |
outputs=gr.outputs.HTML()
|
| 28 |
)
|
| 29 |
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
import requests
|
| 3 |
|
| 4 |
+
def interact_with_server(prompt, ip_address, user_agent):
|
| 5 |
server_url = "http://xzyorb.servemp3.com:80"
|
| 6 |
response = requests.post(server_url, data={"prompt": prompt})
|
| 7 |
response_text = response.text
|
| 8 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
# Count the number of messages in the conversation
|
| 10 |
conversation_messages = response_text.split("<br>") # Assuming each message is separated by "<br>"
|
| 11 |
num_messages = len(conversation_messages)
|
|
|
|
| 19 |
|
| 20 |
iface = gr.Interface(
|
| 21 |
fn=interact_with_server,
|
| 22 |
+
inputs=[gr.inputs.Textbox(), gr.inputs.Textbox(label="IP Address"), gr.inputs.Textbox(label="User Agent")],
|
| 23 |
outputs=gr.outputs.HTML()
|
| 24 |
)
|
| 25 |
|