Spaces:
Runtime error
Runtime error
Commit
·
ec39ba7
1
Parent(s):
ad6eab8
updated app
Browse files- .gitignore +1 -0
- app.py +2 -2
- client.py +13 -0
.gitignore
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
.venv
|
app.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
|
| 3 |
# Define your backend logic in a function
|
| 4 |
-
def
|
| 5 |
# Implement your backend logic here
|
| 6 |
return f"Processed: {input_text}"
|
| 7 |
|
|
@@ -9,4 +9,4 @@ def my_backend_logic(input_text):
|
|
| 9 |
interface = gr.Interface(fn=my_backend_logic, inputs="text", outputs="text")
|
| 10 |
|
| 11 |
# Launch the app (which will be hosted on Hugging Face Spaces)
|
| 12 |
-
interface.launch()
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
|
| 3 |
# Define your backend logic in a function
|
| 4 |
+
def my_backend_ logic(input_text):
|
| 5 |
# Implement your backend logic here
|
| 6 |
return f"Processed: {input_text}"
|
| 7 |
|
|
|
|
| 9 |
interface = gr.Interface(fn=my_backend_logic, inputs="text", outputs="text")
|
| 10 |
|
| 11 |
# Launch the app (which will be hosted on Hugging Face Spaces)
|
| 12 |
+
interface.launch(enable_api=True)
|
client.py
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import requests
|
| 2 |
+
|
| 3 |
+
# Replace this with the URL of your Hugging Face Space
|
| 4 |
+
api_url = "https://huggingface.co/spaces/iceberg0142/test"
|
| 5 |
+
|
| 6 |
+
# Define the input data
|
| 7 |
+
input_data = {"input": "Hello, Hugging Face!"}
|
| 8 |
+
|
| 9 |
+
# Make a POST request to the Space
|
| 10 |
+
response = requests.post(api_url, json=input_data)
|
| 11 |
+
|
| 12 |
+
# Print the response
|
| 13 |
+
print(response)
|