VectorV17 commited on
Commit
40a96a4
Β·
verified Β·
1 Parent(s): 8f9986a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -6
app.py CHANGED
@@ -12,11 +12,12 @@ print("Loading Embedding Engine...")
12
  embedding_model = HuggingFaceEmbeddings(model_name="sentence-transformers/all-MiniLM-L6-v2")
13
 
14
  print("Initializing Local TinyLlama Core on CPU...")
 
15
  chat_pipeline = pipeline(
16
  "text-generation",
17
  model="TinyLlama/TinyLlama-1.1B-Chat-v1.0",
18
  device="cpu",
19
- torch_dtype=torch.float32
20
  )
21
 
22
  # Fact-checking context store
@@ -62,7 +63,7 @@ def execution_engine(workspace_type, user_input, system_injection, max_tokens, t
62
  temperature=float(temp),
63
  top_p=float(top_p),
64
  top_k=40,
65
- repetition_penalty=1.2 # Prevents model looping or stalling on CPU
66
  )
67
 
68
  processed_text = raw_output[0]["generated_text"].split("<|assistant|>\n")[-1].strip()
@@ -96,8 +97,8 @@ with gr.Blocks() as demo:
96
 
97
  # Status Module Panel (Mirroring Right side of Screenshot 583)
98
  with gr.Column(scale=1):
99
- with gr.HighlightedText(value=[("ONLINE", "🟒 NLP Match Engine Status")], show_label=False):
100
- pass
101
  gr.Markdown(
102
  "πŸͺͺ **Agent Profile:** Similarity-Augmented Assistant \n"
103
  "πŸ“¦ **Model Matrix:** TinyLlama-1.1B (Quantized Pipeline) \n"
@@ -117,7 +118,7 @@ with gr.Blocks() as demo:
117
  with gr.Tabs() as active_workspace_tabs:
118
 
119
  # Tab (i): Debate Module
120
- with gr.TabItem("πŸŽ™οΈ News Debate Agent", id=0):
121
  gr.Markdown("*State a topic and your stance. The agent will pull factual context, debate you, and score your logic.*")
122
  debate_text_input = gr.Textbox(
123
  label="Your Stance",
@@ -134,7 +135,7 @@ with gr.Blocks() as demo:
134
  run_debate_action = gr.Button("Deploy Counter-Argument & Score", variant="primary")
135
 
136
  # Tab (ii): Text Simplification Module
137
- with gr.TabItem("πŸ“° Snippet Generalizer", id=1):
138
  gr.Markdown("*Paste complex, jargon-heavy news columns here to output plain-English, executive summaries.*")
139
  simplify_text_input = gr.Textbox(
140
  label="Complex News Snippet",
 
12
  embedding_model = HuggingFaceEmbeddings(model_name="sentence-transformers/all-MiniLM-L6-v2")
13
 
14
  print("Initializing Local TinyLlama Core on CPU...")
15
+ # Replaced deprecated torch_dtype with dtype per pipeline warning
16
  chat_pipeline = pipeline(
17
  "text-generation",
18
  model="TinyLlama/TinyLlama-1.1B-Chat-v1.0",
19
  device="cpu",
20
+ dtype=torch.float32
21
  )
22
 
23
  # Fact-checking context store
 
63
  temperature=float(temp),
64
  top_p=float(top_p),
65
  top_k=40,
66
+ repetition_penalty=1.2
67
  )
68
 
69
  processed_text = raw_output[0]["generated_text"].split("<|assistant|>\n")[-1].strip()
 
97
 
98
  # Status Module Panel (Mirroring Right side of Screenshot 583)
99
  with gr.Column(scale=1):
100
+ # Fixed: Rendered directly without an invalid context manager block
101
+ gr.HighlightedText(value=[("ONLINE", "🟒 NLP Match Engine Status")], show_label=False)
102
  gr.Markdown(
103
  "πŸͺͺ **Agent Profile:** Similarity-Augmented Assistant \n"
104
  "πŸ“¦ **Model Matrix:** TinyLlama-1.1B (Quantized Pipeline) \n"
 
118
  with gr.Tabs() as active_workspace_tabs:
119
 
120
  # Tab (i): Debate Module
121
+ with gr.Tab(label="πŸŽ™οΈ News Debate Agent", id=0):
122
  gr.Markdown("*State a topic and your stance. The agent will pull factual context, debate you, and score your logic.*")
123
  debate_text_input = gr.Textbox(
124
  label="Your Stance",
 
135
  run_debate_action = gr.Button("Deploy Counter-Argument & Score", variant="primary")
136
 
137
  # Tab (ii): Text Simplification Module
138
+ with gr.Tab(label="πŸ“° Snippet Generalizer", id=1):
139
  gr.Markdown("*Paste complex, jargon-heavy news columns here to output plain-English, executive summaries.*")
140
  simplify_text_input = gr.Textbox(
141
  label="Complex News Snippet",