Spaces:
Running
Running
import gradio as gr | |
from agents import init_agent | |
agent=init_agent() | |
def run_agent(query): | |
# Assuming the agent has a method to run a query | |
response=agent.run(query,reset=False) | |
if isinstance(response, list): | |
response="\n".join(response) | |
return response | |
query_input = gr.Textbox( | |
label="Query", | |
placeholder="Enter your query here...", | |
lines=3, | |
max_lines=5 | |
) | |
output=gr.TextArea( | |
label="Response", | |
placeholder="The response will appear here...", | |
lines=10, | |
max_lines=20 | |
) | |
demo = gr.Interface( | |
fn=run_agent, | |
inputs=query_input, | |
outputs=output, | |
title="AtlasIA Assistant", | |
description="Ask me anything and I'll help you find the information you need.", | |
theme=gr.themes.Soft(), | |
examples=[ | |
["names of datasets with image modality"], | |
["what is the most 3 liked datasets"], | |
["find the most downloaded model"], | |
["Who are the members of Atlasia?"], | |
["what is atlasIA community in 3 lines??"], | |
["how i can join the community?"], | |
["how i can contribute to the community?"] | |
], | |
cache_examples=True, | |
flagging_mode="never", | |
css=""" | |
.gradio-container { | |
max-width: 800px; | |
margin: auto; | |
} | |
.gradio-interface { | |
padding: 2rem; | |
} | |
.output-text { | |
white-space: pre-wrap; | |
font-family: 'Courier New', monospace; | |
background-color: #f5f5f5; | |
padding: 1rem; | |
border-radius: 5px; | |
border: 1px solid #ddd; | |
} | |
.input-text { | |
font-size: 1.1em; | |
} | |
.title { | |
font-size: 2em; | |
font-weight: bold; | |
margin-bottom: 1rem; | |
} | |
.description { | |
font-size: 1.2em; | |
color: #666; | |
margin-bottom: 2rem; | |
} | |
""" | |
) | |
if __name__=="__main__": | |
# Initialize the agent | |
demo.launch() | |