Spaces:
Runtime error
Runtime error
File size: 1,710 Bytes
2f36e59 e6efd22 2f36e59 db3fa21 7affa44 2f36e59 e6efd22 2f36e59 e6efd22 2f36e59 7affa44 2f36e59 e6efd22 2f36e59 db3fa21 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
import gradio as gr
import random
def analyze_data(category, text):
# Function implementation to analyze the data based on the selected category
# Replace this with your specific logic
result = f"Analyzing data for {category}: {text}"
return result
def launch_demo():
categories = [
"Appearance",
"Weight",
"Intelligence",
"Age",
"Financial Status",
"Cleanliness/Hygiene",
"Lifestyle",
"Occupation",
"Taste/Culture",
"Cooking Skills"
]
topics = [
"Holidays",
"Plants",
"Animals",
"Countries",
"Pop Culture",
"Religion",
"Lifestyle",
"Environment",
"Technology",
"Sports",
"Music",
"Space/Astronomy",
"Food and Cooking",
"History",
"Travel",
"Education",
"Health and Fitness",
"Movies/TV Shows"
]
def analyze_input(category, text):
result = analyze_data(category, text)
return result
dropdown = gr.components.Dropdown(categories, label="Select a Category")
text_input = gr.components.Textbox(label="Enter Text")
output = gr.components.Textbox(label="Analysis Result")
rando_choice = [random.choice(categories)
rando_topic = [random.choice(topics)
examples = [
rando_choice, rando_topic],
]
gr.Interface(
fn=analyze_input,
inputs=[dropdown, text_input],
outputs=output,
examples=examples,
title="Data Analyzer",
description="Select a category, enter text, and click Submit.",
theme="default",
).launch()
launch_demo()
|