Spaces:
Sleeping
Sleeping
MUHAMMAD YOUSAF RANA
commited on
Commit
Β·
32604e1
1
Parent(s):
f09f529
updated
Browse files
Makefile
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
install:
|
2 |
+
pip install --upgrade pip &&\
|
3 |
+
pip install -r requirements.txt
|
4 |
+
|
5 |
+
test:
|
6 |
+
python -m pytest -vvv --cov=hello --cov=greeting \
|
7 |
+
--cov=smath --cov=web tests
|
8 |
+
python -m pytest --nbval notebook.ipynb # test our jupyter notebook
|
9 |
+
python -m pytest -v tests/test_web.py # if you want to test test_web
|
10 |
+
|
11 |
+
debug:
|
12 |
+
python -m pytest -vv --pdb #debuger is Invoked
|
13 |
+
|
14 |
+
one_test:
|
15 |
+
python -m pytest -vv tests/test_greeting.py::test_my_name4
|
16 |
+
|
17 |
+
debug_three:
|
18 |
+
#not working the way i expected
|
19 |
+
python -m pytest -vv --pdb --maxfail=4 #drop the pdb for first three failure
|
20 |
+
|
21 |
+
format:
|
22 |
+
black *.py
|
23 |
+
|
24 |
+
lint:
|
25 |
+
pylint --disable=R,C *.py
|
26 |
+
all:
|
27 |
+
install lint test format
|
README.md
CHANGED
@@ -1,14 +1,16 @@
|
|
1 |
---
|
2 |
title: hugging-face-demo
|
3 |
-
emoji:
|
4 |
-
colorFrom:
|
5 |
-
colorTo:
|
6 |
-
sdk: gradio
|
7 |
sdk_version: "latest"
|
8 |
-
app_file: app.py
|
9 |
pinned: false
|
|
|
10 |
---
|
11 |
|
|
|
12 |
[](https://github.com/Muhammadyousafrana/hugging-face-demo/actions/workflows/main.yml)
|
13 |
|
14 |
# My Hugging Face Demo App
|
|
|
1 |
---
|
2 |
title: hugging-face-demo
|
3 |
+
emoji: π±βπ
|
4 |
+
colorFrom: purple
|
5 |
+
colorTo: purple
|
6 |
+
sdk: gradio
|
7 |
sdk_version: "latest"
|
8 |
+
app_file: app.py
|
9 |
pinned: false
|
10 |
+
licence: cc
|
11 |
---
|
12 |
|
13 |
+
|
14 |
[](https://github.com/Muhammadyousafrana/hugging-face-demo/actions/workflows/main.yml)
|
15 |
|
16 |
# My Hugging Face Demo App
|
app.py
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from transformers import pipeline
|
2 |
+
import gradio as gr
|
3 |
+
|
4 |
+
# Load the summarization model
|
5 |
+
model = pipeline("summarization")
|
6 |
+
|
7 |
+
def predict(prompt):
|
8 |
+
summary = model(prompt)[0]["summary_text"]
|
9 |
+
return summary
|
10 |
+
|
11 |
+
# Create the Gradio interface
|
12 |
+
with gr.Blocks() as demo:
|
13 |
+
gr.Markdown("## Text Summarization App")
|
14 |
+
gr.Markdown("Enter a block of text below and click Submit to generate a summary.")
|
15 |
+
|
16 |
+
with gr.Row():
|
17 |
+
textbox = gr.Textbox(placeholder="Enter text to summarize", lines=6)
|
18 |
+
|
19 |
+
submit_btn = gr.Button("Summarize")
|
20 |
+
|
21 |
+
output = gr.Textbox(label="Summary", interactive=False)
|
22 |
+
|
23 |
+
submit_btn.click(predict, inputs=textbox, outputs=output)
|
24 |
+
|
25 |
+
# Launch the Gradio app
|
26 |
+
demo.launch()
|
requirements.txt
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
gradio
|
2 |
+
transformers
|
3 |
+
tensorflow
|
4 |
+
tf-keras
|