debug
Browse files- Dockerfile +1 -1
- gradio_python_app.py +0 -13
- index.html +0 -24
- python_app.py +24 -0
- requirements.txt +3 -2
Dockerfile
CHANGED
@@ -21,4 +21,4 @@ RUN pip install --no-cache-dir --upgrade -r $HOME/app/requirements.txt
|
|
21 |
|
22 |
# COPY . .
|
23 |
|
24 |
-
CMD ["python", "
|
|
|
21 |
|
22 |
# COPY . .
|
23 |
|
24 |
+
CMD ["python", "python_app.py", "--host", "0.0.0.0", "--port", "7860"]
|
gradio_python_app.py
DELETED
@@ -1,13 +0,0 @@
|
|
1 |
-
# not sure why matplotlib is needed in the Space
|
2 |
-
import os
|
3 |
-
# os.environ['MPLCONFIGDIR'] = '/code/matplotlib/cfg'
|
4 |
-
|
5 |
-
import gradio as gr
|
6 |
-
|
7 |
-
def greet(name):
|
8 |
-
return "Hello " + name + "!"
|
9 |
-
|
10 |
-
demo = gr.Interface(fn=greet, inputs="text", outputs="text")
|
11 |
-
|
12 |
-
if __name__ == "__main__":
|
13 |
-
demo.launch(show_api=False)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
index.html
DELETED
@@ -1,24 +0,0 @@
|
|
1 |
-
<main>
|
2 |
-
<section id="text-gen">
|
3 |
-
<h2>TEMPLATE HTML FROM HF. Text generation using Flan T5</h2>
|
4 |
-
<p>
|
5 |
-
Model:
|
6 |
-
<a
|
7 |
-
href="https://huggingface.co/google/flan-t5-small"
|
8 |
-
rel="noreferrer"
|
9 |
-
target="_blank"
|
10 |
-
>google/flan-t5-small
|
11 |
-
</a>
|
12 |
-
</p>
|
13 |
-
<form class="text-gen-form">
|
14 |
-
<label for="text-gen-input">Text prompt</label>
|
15 |
-
<input
|
16 |
-
id="text-gen-input"
|
17 |
-
type="text"
|
18 |
-
value="German: There are many ducks"
|
19 |
-
/>
|
20 |
-
<button id="text-gen-submit">Submit</button>
|
21 |
-
<p class="text-gen-output"></p>
|
22 |
-
</form>
|
23 |
-
</section>
|
24 |
-
</main>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
python_app.py
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from dash import Dash, html, dcc, callback, Output, Input
|
2 |
+
import plotly.express as px
|
3 |
+
import pandas as pd
|
4 |
+
|
5 |
+
df = pd.read_csv('https://raw.githubusercontent.com/plotly/datasets/master/gapminder_unfiltered.csv')
|
6 |
+
|
7 |
+
app = Dash(__name__)
|
8 |
+
|
9 |
+
app.layout = html.Div([
|
10 |
+
html.H1(children='Title of Dash App', style={'textAlign':'center'}),
|
11 |
+
dcc.Dropdown(df.country.unique(), 'Canada', id='dropdown-selection'),
|
12 |
+
dcc.Graph(id='graph-content')
|
13 |
+
])
|
14 |
+
|
15 |
+
@callback(
|
16 |
+
Output('graph-content', 'figure'),
|
17 |
+
Input('dropdown-selection', 'value')
|
18 |
+
)
|
19 |
+
def update_graph(value):
|
20 |
+
dff = df[df.country==value]
|
21 |
+
return px.line(dff, x='year', y='pop')
|
22 |
+
|
23 |
+
if __name__ == '__main__':
|
24 |
+
app.run(debug=True)
|
requirements.txt
CHANGED
@@ -1,2 +1,3 @@
|
|
1 |
-
|
2 |
-
|
|
|
|
1 |
+
dash
|
2 |
+
plotly
|
3 |
+
pandas
|