Files changed (1) hide show
  1. app.py +2 -16
app.py CHANGED
@@ -10,7 +10,6 @@ from textblob import TextBlob
10
  import streamlit as st
11
  import seaborn as sns
12
  import plotly.express as px
13
- import gradio as gr
14
  from datetime import datetime, timedelta
15
  import gspread
16
  from google.oauth2.service_account import Credentials
@@ -220,16 +219,7 @@ def recommend_products(query):
220
 
221
  return recommendations
222
 
223
- # Gradio Interface for speech input
224
- def gradio_interface(query):
225
- answer = find_answer(query)
226
- sentiment, sentiment_score, emoji = analyze_sentiment_with_emoji(query)
227
-
228
- recommendations = recommend_products(query)
229
-
230
- return answer, sentiment, emoji, recommendations
231
-
232
- # Function to handle continuous interaction loop (Streamlit version)
233
  def continuous_interaction():
234
  st.title("Speech Recognition with Product Queries")
235
  if st.button("Start Speech Recognition"):
@@ -270,7 +260,7 @@ def continuous_interaction():
270
  st.write(f"Discount: {rec['discount']}%")
271
  st.write("---")
272
 
273
- # Dashboard for visualizations (Streamlit)
274
  def display_dashboard():
275
  st.title("Product Dashboard")
276
  st.write("Welcome to the product query dashboard!")
@@ -338,13 +328,9 @@ def display_dashboard():
338
 
339
  # Main code to run the app
340
  if __name__ == '__main__':
341
- # Select mode between Streamlit and Gradio
342
  mode = st.sidebar.radio("Select Mode", ("Speech Recognition", "Dashboard"))
343
 
344
  if mode == "Speech Recognition":
345
  continuous_interaction()
346
  elif mode == "Dashboard":
347
  display_dashboard()
348
-
349
- # Gradio Interface for queries
350
- gr.Interface(fn=gradio_interface, inputs="text", outputs=["text", "text", "text", "json"]).launch()
 
10
  import streamlit as st
11
  import seaborn as sns
12
  import plotly.express as px
 
13
  from datetime import datetime, timedelta
14
  import gspread
15
  from google.oauth2.service_account import Credentials
 
219
 
220
  return recommendations
221
 
222
+ # Function to handle continuous interaction loop
 
 
 
 
 
 
 
 
 
223
  def continuous_interaction():
224
  st.title("Speech Recognition with Product Queries")
225
  if st.button("Start Speech Recognition"):
 
260
  st.write(f"Discount: {rec['discount']}%")
261
  st.write("---")
262
 
263
+ # Dashboard for visualizations
264
  def display_dashboard():
265
  st.title("Product Dashboard")
266
  st.write("Welcome to the product query dashboard!")
 
328
 
329
  # Main code to run the app
330
  if __name__ == '__main__':
 
331
  mode = st.sidebar.radio("Select Mode", ("Speech Recognition", "Dashboard"))
332
 
333
  if mode == "Speech Recognition":
334
  continuous_interaction()
335
  elif mode == "Dashboard":
336
  display_dashboard()