neovalle commited on
Commit
b0f328f
·
verified ·
1 Parent(s): 3ffa4a4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -2,7 +2,7 @@ import os, json
2
  import gradio as gr
3
  from huggingface_hub import InferenceClient
4
 
5
- # Load your tool prompts
6
  with open("system_prompts.json", encoding="utf-8") as f:
7
  SYSTEM_PROMPTS = json.load(f)
8
 
@@ -16,7 +16,7 @@ def run_model(prompt: str, text: str) -> str:
16
  )
17
  return resp.choices[0].message.content
18
 
19
- # --- Define one named function per tool prompt ---
20
  def ecolinguistic_analysis(text: str) -> str:
21
  """Ecolinguistic Analysis"""
22
  prompt = SYSTEM_PROMPTS["Ecolinguistic Analysis"]
@@ -42,7 +42,7 @@ def ecosophy_scoring(text: str) -> str:
42
  prompt = SYSTEM_PROMPTS["Ecosophy Scoring"]
43
  return run_model(prompt, text)
44
 
45
- # --- Build the Gradio interface with separate interfaces per tool ---
46
  iface1 = gr.Interface(fn=ecolinguistic_analysis, inputs="text", outputs="text",
47
  title="Ecolinguistic Analysis", description=ecolinguistic_analysis.__doc__)
48
  iface2 = gr.Interface(fn=narrative_detection, inputs="text", outputs="text",
 
2
  import gradio as gr
3
  from huggingface_hub import InferenceClient
4
 
5
+ # Load tool prompts
6
  with open("system_prompts.json", encoding="utf-8") as f:
7
  SYSTEM_PROMPTS = json.load(f)
8
 
 
16
  )
17
  return resp.choices[0].message.content
18
 
19
+ # Define one named function per tool prompt
20
  def ecolinguistic_analysis(text: str) -> str:
21
  """Ecolinguistic Analysis"""
22
  prompt = SYSTEM_PROMPTS["Ecolinguistic Analysis"]
 
42
  prompt = SYSTEM_PROMPTS["Ecosophy Scoring"]
43
  return run_model(prompt, text)
44
 
45
+ # Build the Gradio interface
46
  iface1 = gr.Interface(fn=ecolinguistic_analysis, inputs="text", outputs="text",
47
  title="Ecolinguistic Analysis", description=ecolinguistic_analysis.__doc__)
48
  iface2 = gr.Interface(fn=narrative_detection, inputs="text", outputs="text",