EmmanuelCasarrubias's picture
Refactored Streamlit app for Hugging Face deployment - Replaced matplotlib with plotly for an enhanced, interactive graph. - Separated core functionalities into separate modules for cleaner code and easier maintenance. - Simplified the Streamlit app code, focusing on user input and real-time graph generation.
6abca00 verified
raw
history blame
570 Bytes
import streamlit as st
import plotly.graph_objs as go
from transform_word import transform_word
st.title("Transformer Contextual Text Generator with Real-Time Graph")
# Input from user
word = st.text_input("Enter a word or phrase")
if word:
significant_numbers = transform_word(word)
# Plotting
fig = go.Figure(data=go.Scatter(y=significant_numbers, mode='lines+markers'))
fig.update_layout(title='Real-Time Graph',
xaxis_title='Character Index',
yaxis_title='Significant Number')
st.plotly_chart(fig)