Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
import yaml
|
| 3 |
+
|
| 4 |
+
def load_config(config_path="config.yaml"):
|
| 5 |
+
with open(config_path, "r") as f:
|
| 6 |
+
return yaml.safe_load(f)
|
| 7 |
+
|
| 8 |
+
config = load_config()
|
| 9 |
+
|
| 10 |
+
# Example function to serve
|
| 11 |
+
def agent_interface(input_text):
|
| 12 |
+
# Use config and do something with input_text
|
| 13 |
+
return f"Processed: {input_text}"
|
| 14 |
+
|
| 15 |
+
# Define the Gradio app
|
| 16 |
+
iface = gr.Interface(fn=agent_interface, inputs="text", outputs="text")
|
| 17 |
+
|
| 18 |
+
# Launch if running directly
|
| 19 |
+
if __name__ == "__main__":
|
| 20 |
+
iface.launch()
|