Spaces:
Runtime error
Runtime error
Denver Citizen9
commited on
Commit
•
2f36e59
1
Parent(s):
90d73a1
initial try
Browse files
app.py
ADDED
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
import random
|
3 |
+
|
4 |
+
def analyze_data(category, text):
|
5 |
+
# Function implementation to analyze the data based on the selected category
|
6 |
+
# Replace this with your specific logic
|
7 |
+
result = f"Analyzing data for {category}: {text}"
|
8 |
+
return result
|
9 |
+
|
10 |
+
def launch_demo():
|
11 |
+
categories = [
|
12 |
+
"Appearance",
|
13 |
+
"Weight",
|
14 |
+
"Intelligence",
|
15 |
+
"Age",
|
16 |
+
"Financial Status",
|
17 |
+
"Cleanliness/Hygiene",
|
18 |
+
"Lifestyle",
|
19 |
+
"Occupation",
|
20 |
+
"Taste/Culture",
|
21 |
+
"Cooking Skills"
|
22 |
+
]
|
23 |
+
|
24 |
+
def analyze_input(category, text):
|
25 |
+
result = analyze_data(category, text)
|
26 |
+
return result
|
27 |
+
|
28 |
+
dropdown = gr.inputs.Dropdown(categories, label="Select a Category")
|
29 |
+
text_input = gr.inputs.Textbox(label="Enter Text")
|
30 |
+
button = gr.inputs.Button(label="Submit")
|
31 |
+
output = gr.outputs.Textbox(label="Analysis Result")
|
32 |
+
|
33 |
+
examples = [
|
34 |
+
[random.choice(categories), "Example input 1"],
|
35 |
+
[random.choice(categories), "Example input 2"],
|
36 |
+
]
|
37 |
+
|
38 |
+
gr.Interface(
|
39 |
+
fn=analyze_input,
|
40 |
+
inputs=[dropdown, text_input, button],
|
41 |
+
outputs=output,
|
42 |
+
examples=examples,
|
43 |
+
title="Data Analyzer",
|
44 |
+
description="Select a category, enter text, and click Submit to analyze the data.",
|
45 |
+
theme="default",
|
46 |
+
).launch()
|
47 |
+
|
48 |
+
launch_demo()
|