Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
altair
pandas
streamlit
transformers
torch
GoogleBard
langchain
ProGPT
edge-tts
45 changes: 9 additions & 36 deletions streamlit_app.py
Original file line number Diff line number Diff line change
@@ -1,40 +1,13 @@
import altair as alt
import numpy as np
import pandas as pd
import streamlit as st
from transformers import pipeline

"""
# Welcome to Streamlit!
# Load the text-to-speech pipeline
tts_pipeline = pipeline("text-to-speech")

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).
# Text input field
text_input = st.text_input("Enter text to be spoken:")

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])),
))
# Generate audio and play it
if text_input:
audio = tts_pipeline(text_input)
st.audio(audio)