ahmedkobtan commited on
Commit
5982fe9
·
1 Parent(s): d98cf4c

adding HF sync code

Browse files
.github/main.yml ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: Sync to Hugging Face Hub
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ [main]
7
+
8
+
9
+ # to run this workflow manually from the Actions tab
10
+ workflow_dispatch:
11
+
12
+
13
+ jobs:
14
+ sync to hub:
15
+ runs-on: ubuntu-latest
16
+ steps:
17
+ - uses: actions/checkout@v2
18
+ with:
19
+ fetch-depth: 0
20
+ - name: Add remote
21
+ env:
22
+ HF: ${{ secrets.HF}}
23
+ run: git remote add space https://auk003i:HF@huggingface.co/spaces/akobtan/demo
24
+ - name: Push to hub
25
+ env:
26
+ HF: ${{ secrets.HF}}
27
+ run: git push --force https://auk003i:HF@huggingface.co/spaces/akobtan/demo main
Makefile CHANGED
@@ -3,6 +3,22 @@ install:
3
  pip install -r requirements.txt
4
 
5
  test:
6
- python -m pytest -vv --cov=hello test_hello.py
 
7
 
8
- all: install test
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  pip install -r requirements.txt
4
 
5
  test:
6
+ python -m pytest -vvv --cov=hello --cov=greeting --cov=smath --cov=web tests
7
+ # python -m pytest --nbval notebook.ipynb # tests our jupyter notebook, --nbval not working
8
 
9
+ debug:
10
+ python -m pytest -vv --pdb # Debugger is invoked
11
+
12
+ onetest:
13
+ python -m pytest -vv tests/test_greeting.py:test_my_name4 # what is test_my_name4?
14
+
15
+ debugthree:
16
+ python -m pytest -vv --pdb -maxfail=4
17
+
18
+ format:
19
+ black *.py
20
+
21
+ lint:
22
+ pylint --disable=R,C *.py
23
+
24
+ all: install test lint format
app.py ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from transformers import pipeline
2
+ import gradio as gr
3
+
4
+ model = pipeline("summarization")
5
+
6
+
7
+ def predict(prompt):
8
+ summary = model(prompt)[0]["summary_text"]
9
+ return summary
10
+
11
+
12
+ with gr.Blocks() as demo:
13
+ textbox = gr.Textbox(placeholder="Enter text block to summarize", lines=4)
14
+ gr.Interface(fn=predict, inputs=textbox, outputs="text")
15
+
16
+ demo.launch()
hello.py CHANGED
@@ -1,2 +1,2 @@
1
  def more_hello():
2
- return "hi"
 
1
  def more_hello():
2
+ return "hi"
notebook.ipynb ADDED
File without changes
requirements.txt CHANGED
@@ -1,2 +1,6 @@
1
  pytest
2
- pytest-cov
 
 
 
 
 
1
  pytest
2
+ pytest-cov
3
+ gradio
4
+ transformers
5
+ tensorflow
6
+ tf-keras
test_hello.py → tests/test_greeting.py RENAMED
File without changes