From a7ffe735fc3f1276c3cf1f6e84d059af6911d23f Mon Sep 17 00:00:00 2001 From: Gabriel D'andrea <134967017+zxcvbs1@users.noreply.github.com> Date: Sun, 11 Feb 2024 21:37:16 -0300 Subject: [PATCH 1/5] Update streamlit_app.py --- streamlit_app.py | 58 +++++++++++++++++------------------------------- 1 file changed, 20 insertions(+), 38 deletions(-) diff --git a/streamlit_app.py b/streamlit_app.py index 7a0ed1272052..12a5af48337f 100644 --- a/streamlit_app.py +++ b/streamlit_app.py @@ -1,40 +1,22 @@ -import altair as alt -import numpy as np -import pandas as pd import streamlit as st +from transformers import pipeline +from PIL import Image + +pipeline = pipeline(task="image-classification", model="julien-c/hotdog-not-hotdog") + +st.title("Hot Dog? Or Not?") + +file_name = st.file_uploader("Upload a hot dog candidate image") + +if file_name is not None: + col1, col2 = st.columns(2) + + image = Image.open(file_name) + col1.image(image, use_column_width=True) + predictions = pipeline(image) + + col2.header("Probabilities") + for p in predictions: + col2.subheader(f"{ p['label'] }: { round(p['score'] * 100, 1)}%") + -""" -# Welcome to Streamlit! - -Edit `/streamlit_app.py` to customize this app to your heart's desire :heart:. -If you have any questions, checkout our [documentation](https://docs.streamlit.io) and [community -forums](https://discuss.streamlit.io). - -In the meantime, below is an example of what you can do with just a few lines of code: -""" - -num_points = st.slider("Number of points in spiral", 1, 10000, 1100) -num_turns = st.slider("Number of turns in spiral", 1, 300, 31) - -indices = np.linspace(0, 1, num_points) -theta = 2 * np.pi * num_turns * indices -radius = indices - -x = radius * np.cos(theta) -y = radius * np.sin(theta) - -df = pd.DataFrame({ - "x": x, - "y": y, - "idx": indices, - "rand": np.random.randn(num_points), -}) - -st.altair_chart(alt.Chart(df, height=700, width=700) - .mark_point(filled=True) - .encode( - x=alt.X("x", axis=None), - y=alt.Y("y", axis=None), - color=alt.Color("idx", legend=None, scale=alt.Scale()), - size=alt.Size("rand", legend=None, scale=alt.Scale(range=[1, 150])), - )) From b91529bd06cefe03d93d8c9364b28d0c8f409c77 Mon Sep 17 00:00:00 2001 From: Gabriel D'andrea <134967017+zxcvbs1@users.noreply.github.com> Date: Mon, 12 Feb 2024 01:21:43 +0000 Subject: [PATCH 2/5] COMMIT TO REQ --- requirements.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/requirements.txt b/requirements.txt index 502d7d1a0d19..ff01959d839b 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,5 @@ altair pandas streamlit +transformers +torch From 3b32c294c57505dd5e05ff5366b75e5c8541f8ae Mon Sep 17 00:00:00 2001 From: Gabriel D'andrea <134967017+zxcvbs1@users.noreply.github.com> Date: Sun, 11 Feb 2024 23:03:30 -0300 Subject: [PATCH 3/5] Update streamlit_app.py --- streamlit_app.py | 25 ++++++++----------------- 1 file changed, 8 insertions(+), 17 deletions(-) diff --git a/streamlit_app.py b/streamlit_app.py index 12a5af48337f..b9a7dcb5afda 100644 --- a/streamlit_app.py +++ b/streamlit_app.py @@ -1,22 +1,13 @@ import streamlit as st from transformers import pipeline -from PIL import Image -pipeline = pipeline(task="image-classification", model="julien-c/hotdog-not-hotdog") - -st.title("Hot Dog? Or Not?") - -file_name = st.file_uploader("Upload a hot dog candidate image") - -if file_name is not None: - col1, col2 = st.columns(2) - - image = Image.open(file_name) - col1.image(image, use_column_width=True) - predictions = pipeline(image) - - col2.header("Probabilities") - for p in predictions: - col2.subheader(f"{ p['label'] }: { round(p['score'] * 100, 1)}%") +# Load the text-to-speech pipeline +tts_pipeline = pipeline("text-to-speech", model="your_chosen_model_name") +# Text input field +text_input = st.text_input("Enter text to be spoken:") +# Generate audio and play it +if text_input: + audio = tts_pipeline(text_input) + st.audio(audio) From c1a0147efb5f2079fff154f7b88b1882fbc31721 Mon Sep 17 00:00:00 2001 From: Gabriel D'andrea <134967017+zxcvbs1@users.noreply.github.com> Date: Sun, 11 Feb 2024 23:06:59 -0300 Subject: [PATCH 4/5] Update streamlit_app.py changed model --- streamlit_app.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/streamlit_app.py b/streamlit_app.py index b9a7dcb5afda..de0ac2066739 100644 --- a/streamlit_app.py +++ b/streamlit_app.py @@ -2,7 +2,7 @@ from transformers import pipeline # Load the text-to-speech pipeline -tts_pipeline = pipeline("text-to-speech", model="your_chosen_model_name") +tts_pipeline = pipeline("text-to-speech") # Text input field text_input = st.text_input("Enter text to be spoken:") From 83d7b4145e6ed95a77a18a0afd6eac746d283534 Mon Sep 17 00:00:00 2001 From: Gabriel D'andrea <134967017+zxcvbs1@users.noreply.github.com> Date: Tue, 13 Feb 2024 02:15:51 +0000 Subject: [PATCH 5/5] updating requirem --- requirements.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/requirements.txt b/requirements.txt index ff01959d839b..151bd8f69a39 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,3 +3,7 @@ pandas streamlit transformers torch +GoogleBard +langchain +ProGPT +edge-tts \ No newline at end of file