muhammadfaysal5 commited on
Commit
73a8b90
·
1 Parent(s): a2f462c

first one

Browse files
Files changed (4) hide show
  1. .github/workflows/main.yml +23 -0
  2. Makefile +27 -0
  3. app.py +18 -0
  4. requirements.txt +3 -0
.github/workflows/main.yml ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: Sync to Hugging Face hub
2
+ on:
3
+ push:
4
+ branches: [main]
5
+
6
+ # to run this workflow manually from the Actions tab
7
+ workflow_dispatch:
8
+
9
+ jobs:
10
+ sync-to-hub:
11
+ runs-on: ubuntu-latest
12
+ steps:
13
+ - uses: actions/checkout@v2
14
+ with:
15
+ fetch-depth: 0
16
+ - name: Add remote
17
+ env:
18
+ HF: ${{ secrets.HF }}
19
+ run: git remote add space https://MuhammadFaisalHayat:$HF@huggingface.co/spaces/MuhammadFaisalHayat/MLops
20
+ - name: Push to hub
21
+ env:
22
+ HF: ${{ secrets.HF }}
23
+ run: git push --force https://MuhammadFaisalHayat:$HF@huggingface.co/spaces/MuhammadFaisalHayat/MLops main
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 #tests our jupyter notebook
9
+ #python -m pytest -v tests/test_web.py #if you just want to test web
10
+
11
+ debug:
12
+ python -m pytest -vv --pdb #Debugger is invoked
13
+
14
+ one-test:
15
+ python -m pytest -vv tests/test_greeting.py::test_my_name4
16
+
17
+ debugthree:
18
+ #not working the way I expect
19
+ python -m pytest -vv --pdb --maxfail=4 # drop to PDB for first three failures
20
+
21
+ format:
22
+ black *.py
23
+
24
+ lint:
25
+ pylint --disable=R,C *.py
26
+
27
+ all: install lint test format
app.py ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from transformers import pipeline
2
+ import gradio as gr
3
+
4
+
5
+ model = pipeline(
6
+ "summarization",
7
+ )
8
+
9
+ def predict(prompt):
10
+ summary = model(prompt)[0]["summary_text"]
11
+ return summary
12
+
13
+
14
+ # create an interface for the model
15
+ with gr.Blocks() as demo:
16
+ textbox = gr.Textbox(placeholder="Enter the text to summurize ",lines=4)
17
+ gr.Interface(fn=predict, inputs="textbox", outputs="text")
18
+ demo.launch()
requirements.txt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ gradio
2
+ transformers
3
+ tensorflow