Ezinwanne Aka commited on
Commit
d89c5e5
·
1 Parent(s): 1be8d96

created gradio app

Browse files
Files changed (4) hide show
  1. app.py +14 -0
  2. flagged/log.csv +6 -0
  3. makefile +27 -0
  4. requirements.txt +3 -0
app.py ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from transformers import pipeline
2
+ import gradio as gr
3
+
4
+ model = pipeline("summarization")
5
+
6
+ def predict(prompt):
7
+ summary = model(prompt)[0]['summary text']
8
+ return summary
9
+
10
+ with gr.Blocks() as demo:
11
+ textbox = gr.Textbox(placeholder = "Enter text block to summarize", lines = 4)
12
+ gr.Interface(fn=predict, inputs=textbox, outputs="text")
13
+
14
+ demo.launch()
flagged/log.csv ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ prompt,output,flag,username,timestamp
2
+ "It seems like you're encountering an issue related to the context length of a language model. The error message indicates that the maximum context length for the model is 4097 tokens, but your request exceeds that limit with 1904115 tokens.
3
+
4
+ To resolve this issue, you'll need to reduce the length of your input text or split it into smaller segments that fit within the model's maximum context length. This is necessary to ensure that the model can effectively process and generate responses within its capacity.
5
+
6
+ If you have specific questions or need assistance with a particular aspect of your input, feel free to provide more details, and I'll do my best to help!",,,,2024-02-06 15:42:02.726757
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
requirements.txt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ gradio
2
+ transformers
3
+ tensorflow