Kvikontent commited on
Commit
7f38208
·
verified ·
1 Parent(s): 4b74a37

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -4
app.py CHANGED
@@ -10,13 +10,24 @@ def analyze_text(text):
10
 
11
  # Extract the label and confidence score
12
  label = result['label']
13
- score = result['score']
14
 
15
- return {"Result": label, "Confidence (%)": score * 100}
 
 
 
 
 
 
16
 
17
- # Gradio interface with soft theme
18
  gr.Interface(analyze_text,
19
  "text",
20
- "text",
 
 
 
 
 
21
  theme="soft"
22
  ).launch()
 
10
 
11
  # Extract the label and confidence score
12
  label = result['label']
13
+ score = result['score'] * 100
14
 
15
+ # Beautify the output
16
+ if label == 'LABEL_0':
17
+ result_text = "This text is likely fake."
18
+ else:
19
+ result_text = "This text is likely true."
20
+
21
+ return {"Prediction": result_text, "Confidence (%)": f"{score:.2f}"}
22
 
23
+ # Gradio interface with soft theme, title, description, input examples, and output labels
24
  gr.Interface(analyze_text,
25
  "text",
26
+ "label",
27
+ title="Fake vs. True Text Analyzer",
28
+ description="Enter a piece of text to analyze whether it is likely fake or true.",
29
+ inputs=[gr.Textbox(label="Text", placeholder="Enter text here")],
30
+ examples=["Elon Musk is rich person", "Moon was discovered in 1908 by Cristiano Ronaldo"],
31
+ outputs="text",
32
  theme="soft"
33
  ).launch()