appstore / app /main.py
notes73
Initial project upload
6410a28
import streamlit as st
from app.models.upload import upload_model_to_hf
from app.models.fetch import fetch_models
from app.reviews.reviews import add_review, get_reviews
# App title
st.title("AI Agent App Store")
# Sidebar for uploading models
with st.sidebar:
st.header("Upload Your AI Agent")
model_name = st.text_input("Model Name")
model_description = st.text_area("Description")
model_tags = st.text_input("Tags (comma-separated)")
model_file = st.file_uploader("Upload Model Files")
if st.button("Upload"):
if model_name and model_description and model_file:
upload_model_to_hf(model_name, model_description, model_tags, model_file)
st.success("Model uploaded successfully!")
else:
st.error("Please fill all fields.")
# Main section for browsing models
st.header("Browse AI Agents")
search_query = st.text_input("Search for AI Agents")
models = fetch_models(search_query)
for model in models:
st.subheader(model.id)
st.write(model.tags)
st.write(model.description)
if st.button(f"Download {model.id}"):
st.write(f"Downloading {model.id}...")
# Reviews section
st.subheader("Reviews")
reviews = get_reviews(model.id)
for review in reviews:
st.write(f"Rating: {review[2]}/5")
st.write(f"Review: {review[3]}")
with st.expander("Add a Review"):
user_id = st.text_input("Your Name")
rating = st.slider("Rating", 1, 5)
review_text = st.text_area("Your Review")
if st.button("Submit Review"):
add_review(model.id, user_id, rating, review_text)
st.success("Review submitted!")