gpantaz commited on
Commit
2a67d66
·
1 Parent(s): ee5bfab

Add application file

Browse files
__pycache__/character_util.cpython-311.pyc DELETED
Binary file (11.9 kB)
 
__pycache__/playground_app.cpython-311.pyc DELETED
Binary file (5.94 kB)
 
__pycache__/playground_examples.cpython-311.pyc DELETED
Binary file (1.04 kB)
 
__pycache__/playground_util.cpython-311.pyc DELETED
Binary file (5.98 kB)
 
__pycache__/vocab.cpython-311.pyc DELETED
Binary file (27.5 kB)
 
app.py CHANGED
@@ -1,25 +1,25 @@
 
 
1
  import gradio as gr
2
- from transformers import pipeline
3
 
4
- pipeline = pipeline(task="image-classification", model="julien-c/hotdog-not-hotdog")
5
 
 
 
 
6
 
7
- def predict(input_img):
8
- predictions = pipeline(input_img)
9
- return input_img, {p["label"]: p["score"] for p in predictions}
10
 
 
 
 
 
 
11
 
12
- gradio_app = gr.Interface(
13
- predict,
14
- inputs=gr.Image(
15
- label="Select hot dog candidate", sources=["upload", "webcam"], type="pil"
16
- ),
17
- outputs=[
18
- gr.Image(label="Processed Image"),
19
- gr.Label(label="Result", num_top_classes=2),
20
- ],
21
- title="Hot Dog? Or Not?",
22
- )
23
 
24
  if __name__ == "__main__":
25
- gradio_app.launch()
 
 
1
+ import os
2
+
3
  import gradio as gr
4
+ from huggingface_hub import login
5
 
6
+ from playground_app import demo as playground_tab
7
 
8
+ auth_token = os.environ.get("HF_TOKEN", None)
9
+ if auth_token:
10
+ login(token=auth_token)
11
 
 
 
 
12
 
13
+ title = """
14
+ <div align="center">
15
+ <span>Tokenization Playground</span>
16
+ </div>
17
+ """
18
 
19
+ with gr.Blocks() as demo:
20
+ _ = gr.HTML(f"<h1 style='text-align: center; margin-bottom: 1rem'>{title}</h1>")
21
+ _ = playground_tab.render()
 
 
 
 
 
 
 
 
22
 
23
  if __name__ == "__main__":
24
+ demo.launch()
25
+ # demo.launch(share=True)