SmokeyBandit commited on
Commit
cdaada6
·
verified ·
1 Parent(s): 79bd1cd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +24 -39
app.py CHANGED
@@ -12,12 +12,29 @@ from transformers import pipeline
12
  logging.basicConfig(level=logging.DEBUG, format='%(asctime)s - %(levelname)s - %(message)s')
13
 
14
  # =============================================================================
15
- # Load In-House Hugging Face Models for AI Agents
16
  # =============================================================================
17
- # Replace these model IDs with your actual in-house model names.
18
- summarizer = pipeline("summarization", model="myorg/inhouse-summarizer")
19
- research_generator = pipeline("text-generation", model="myorg/inhouse-research", max_length=100)
20
- planner_generator = pipeline("text-generation", model="myorg/inhouse-planner", max_length=150)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
21
 
22
  # =============================================================================
23
  # Helper Functions: Interactive Chart Generators
@@ -378,42 +395,10 @@ def display_pitch_deck_overview():
378
  """
379
  return pitch_deck
380
 
381
- # =============================================================================
382
- # New Agent Functions Using In-House Hugging Face Models
383
- # =============================================================================
384
- def report_agent(data):
385
- """
386
- Generates a summary report using the in-house summarizer model.
387
- """
388
- if not data or len(data.strip()) == 0:
389
- return "Please provide input text for summarization."
390
- summary = summarizer(data, max_length=130, min_length=30, do_sample=False)
391
- logging.debug("Summary generated using in-house summarizer.")
392
- return summary[0]['summary_text']
393
-
394
- def planning_agent(goal):
395
- """
396
- Generates a detailed action plan based on the provided goal using the in-house planner model.
397
- """
398
- if not goal or len(goal.strip()) == 0:
399
- return "Please provide a goal for planning."
400
- plan = planner_generator(goal, max_length=150, num_return_sequences=1)
401
- logging.debug("Plan generated using in-house planner.")
402
- return plan[0]['generated_text']
403
-
404
- def research_agent(query):
405
- """
406
- Generates research insights based on the provided query using the in-house research generator.
407
- """
408
- if not query or len(query.strip()) == 0:
409
- return "Please provide a research query."
410
- result = research_generator(query, max_length=100, num_return_sequences=1)
411
- logging.debug("Research output generated using in-house research model.")
412
- return result[0]['generated_text']
413
-
414
  # =============================================================================
415
  # End of Helper Functions
416
  # =============================================================================
 
417
  # -----------------------------------------------------------------------------
418
  # Construct the Gradio Interface with Multiple Tabs
419
  # -----------------------------------------------------------------------------
@@ -610,7 +595,7 @@ with gr.Blocks(theme=gr.themes.Soft(), css="""
610
  """)
611
 
612
  # -------------------------------------------------------------------------
613
- # Tab 8: SaaS Solutions & Revenue Model
614
  # -------------------------------------------------------------------------
615
  with gr.TabItem("🖥️ SaaS Solutions & Revenue Model"):
616
  gr.Markdown("""
 
12
  logging.basicConfig(level=logging.DEBUG, format='%(asctime)s - %(levelname)s - %(message)s')
13
 
14
  # =============================================================================
15
+ # Load In-House Hugging Face Models for AI Agents with Fallbacks
16
  # =============================================================================
17
+ # Replace these model IDs with your actual in-house model names and token if available.
18
+ try:
19
+ summarizer = pipeline("summarization", model="myorg/inhouse-summarizer")
20
+ logging.info("Loaded in-house summarizer.")
21
+ except Exception as e:
22
+ logging.error("In-house summarizer not found, falling back: %s", e)
23
+ summarizer = pipeline("summarization", model="facebook/bart-large-cnn")
24
+
25
+ try:
26
+ research_generator = pipeline("text-generation", model="myorg/inhouse-research", max_length=100)
27
+ logging.info("Loaded in-house research generator.")
28
+ except Exception as e:
29
+ logging.error("In-house research generator not found, falling back: %s", e)
30
+ research_generator = pipeline("text-generation", model="gpt2", max_length=100)
31
+
32
+ try:
33
+ planner_generator = pipeline("text-generation", model="myorg/inhouse-planner", max_length=150)
34
+ logging.info("Loaded in-house planner generator.")
35
+ except Exception as e:
36
+ logging.error("In-house planner generator not found, falling back: %s", e)
37
+ planner_generator = pipeline("text-generation", model="gpt2", max_length=150)
38
 
39
  # =============================================================================
40
  # Helper Functions: Interactive Chart Generators
 
395
  """
396
  return pitch_deck
397
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
398
  # =============================================================================
399
  # End of Helper Functions
400
  # =============================================================================
401
+
402
  # -----------------------------------------------------------------------------
403
  # Construct the Gradio Interface with Multiple Tabs
404
  # -----------------------------------------------------------------------------
 
595
  """)
596
 
597
  # -------------------------------------------------------------------------
598
+ # Tab 8: SaaS Solutions, Systems & Revenue Model
599
  # -------------------------------------------------------------------------
600
  with gr.TabItem("🖥️ SaaS Solutions & Revenue Model"):
601
  gr.Markdown("""