John6666 commited on
Commit
45a3a5a
·
verified ·
1 Parent(s): f0926c0

Upload 5 files

Browse files
Files changed (5) hide show
  1. README.md +13 -12
  2. app.py +35 -0
  3. packages.txt +1 -0
  4. pre-requirements.txt +1 -0
  5. requirements.txt +3 -0
README.md CHANGED
@@ -1,12 +1,13 @@
1
- ---
2
- title: Testfndetect
3
- emoji: 💻
4
- colorFrom: blue
5
- colorTo: red
6
- sdk: gradio
7
- sdk_version: 5.5.0
8
- app_file: app.py
9
- pinned: false
10
- ---
11
-
12
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
1
+ ---
2
+ title: test Fake News Recognition
3
+ emoji: 🙄
4
+ colorFrom: indigo
5
+ colorTo: purple
6
+ sdk: gradio
7
+ sdk_version: 4.44.0
8
+ app_file: app.py
9
+ pinned: false
10
+ license: mit
11
+ ---
12
+
13
+ Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
app.py ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ if os.environ.get("SPACES_ZERO_GPU") is not None:
3
+ import spaces
4
+ else:
5
+ class spaces:
6
+ @staticmethod
7
+ def GPU(func):
8
+ def wrapper(*args, **kwargs):
9
+ return func(*args, **kwargs)
10
+ return wrapper
11
+ import gradio as gr
12
+ import subprocess
13
+
14
+
15
+ from transformers import pipeline
16
+ MODEL = "winterForestStump/Roberta-fake-news-detector"
17
+ clf = pipeline("text-classification", model=MODEL, tokenizer=MODEL)
18
+
19
+ text = "From the very beginning, the EU has been extremely non-transparent. The deployment of the European Union presence in Armenia was carried out forcefully, under serious pressure from Brussels"
20
+
21
+
22
+ @spaces.GPU
23
+ def infer(text: str):
24
+ result = clf(text)
25
+ return result
26
+
27
+
28
+ with gr.Blocks() as demo:
29
+ input_text= gr.Audio(label="Input", value=text, show_copy_button=True)
30
+ run_button = gr.Button("Run", variant="primary")
31
+ output_text = gr.Textbox(label="Output", value="", show_copy_button=True)
32
+
33
+ run_button.click(infer, [input_text], [output_text])
34
+
35
+ demo.launch()
packages.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ git lfs
pre-requirements.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ pip>=24.1
requirements.txt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ huggingface_hub
2
+ torch
3
+ transformers