Fixed all bugs, working condition -> Making a demo of this

#6
Files changed (1) hide show
  1. app.py +16 -35
app.py CHANGED
@@ -5,9 +5,8 @@ import pandas as pd
5
  import numpy as np
6
  from datetime import datetime, timedelta
7
  from typing import Dict, List, Any
8
- from transformers import AutoModelForCausalLM, AutoTokenizer
9
- import torch
10
  import streamlit as st
 
11
 
12
  # --- Data Processing Class ---
13
  class DataProcessor:
@@ -360,19 +359,7 @@ def render_brainstorm_page():
360
  st.info("No products yet. Create one to get started!")
361
 
362
 
363
- class LLaMAAssistant:
364
- def __init__(self, model_name="meta-llama/Llama-2-7b-chat-hf"):
365
- try:
366
- self.tokenizer = AutoTokenizer.from_pretrained(model_name)
367
- self.model = AutoModelForCausalLM.from_pretrained(
368
- model_name,
369
- torch_dtype=torch.float16,
370
- device_map="auto"
371
- )
372
- except Exception as e:
373
- st.error(f"Model loading error: {e}")
374
- self.model = None
375
- self.tokenizer = None
376
 
377
  def generate_response(self, prompt: str, context: list = None) -> str:
378
  if not self.model or not self.tokenizer:
@@ -412,20 +399,19 @@ class LLaMAAssistant:
412
 
413
  def render_chat():
414
  st.header("πŸ’¬AI Business Mentor")
415
- st.title("πŸ€– Prospira AI Business Mentor")
416
- st.write("""
 
417
  <iframe
418
  src="https://demoorganisation34-chatbot-for-prospira.hf.space"
419
- frameborder="0"
420
- width="850"
421
- height="450"
422
- ></iframe>
423
- """, unsafe_allow_html=True)
424
 
425
  def render_home():
426
  st.title("πŸš€ Welcome to Prospira")
427
  st.subheader("πŸ“Š Data-Driven Solutions for Businesses and Creators")
428
-
429
  st.markdown("""
430
  **Prospira** empowers businesses and creators to enhance their content, products, and marketing strategies using AI-driven insights.
431
 
@@ -440,22 +426,17 @@ def render_home():
440
  def main():
441
  st.set_page_config(
442
  page_title="Prospira",
443
- page_icon="πŸ“Š",
444
- layout="wide",
445
  initial_sidebar_state="expanded"
446
  )
447
-
448
- with st.sidebar:
449
- st.title("Prospira")
450
- st.subheader("Data-Driven Solutions")
451
-
452
- page = st.radio(
453
- "Navigation",
454
- ["Home", "Dashboard", "Analytics", "Brainstorm", "Chat"]
455
- )
456
  if page == "Home":
457
  render_home()
458
- if page == "Dashboard":
459
  render_dashboard()
460
  elif page == "Analytics":
461
  render_analytics()
 
5
  import numpy as np
6
  from datetime import datetime, timedelta
7
  from typing import Dict, List, Any
 
 
8
  import streamlit as st
9
+ import streamlit.components.v1 as components
10
 
11
  # --- Data Processing Class ---
12
  class DataProcessor:
 
359
  st.info("No products yet. Create one to get started!")
360
 
361
 
362
+
 
 
 
 
 
 
 
 
 
 
 
 
363
 
364
  def generate_response(self, prompt: str, context: list = None) -> str:
365
  if not self.model or not self.tokenizer:
 
399
 
400
  def render_chat():
401
  st.header("πŸ’¬AI Business Mentor")
402
+ st.title("πŸ€– Prospira AI Business Mentor")
403
+
404
+ iframe_code = """
405
  <iframe
406
  src="https://demoorganisation34-chatbot-for-prospira.hf.space"
407
+ width="100%" height="500" frameborder="0">
408
+ </iframe>
409
+ """
410
+ components.html(iframe_code, height=600)
 
411
 
412
  def render_home():
413
  st.title("πŸš€ Welcome to Prospira")
414
  st.subheader("πŸ“Š Data-Driven Solutions for Businesses and Creators")
 
415
  st.markdown("""
416
  **Prospira** empowers businesses and creators to enhance their content, products, and marketing strategies using AI-driven insights.
417
 
 
426
  def main():
427
  st.set_page_config(
428
  page_title="Prospira",
429
+ page_icon="πŸš€",
430
+ layout="centered",
431
  initial_sidebar_state="expanded"
432
  )
433
+
434
+ # Create a selection box to choose between pages
435
+ page = st.sidebar.radio("Select a page", ["Home", "Dashboard", "Analytics", "Brainstorm", "Chat"])
436
+
 
 
 
 
 
437
  if page == "Home":
438
  render_home()
439
+ elif page == "Dashboard":
440
  render_dashboard()
441
  elif page == "Analytics":
442
  render_analytics()