![EmmanuelCasarrubias's picture](https://cdn-avatars.huggingface.co/v1/production/uploads/6591ca5c35c41262d6ac8e57/Xnl0N6SnpoQyqkT5peDNb.jpeg)
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
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) | |