TharunSivamani
commited on
Commit
•
660c3f5
1
Parent(s):
cd86bb8
final commits
Browse files- app.py +22 -0
- requirements.txt +10 -0
app.py
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import torch
|
2 |
+
import gradio as gr
|
3 |
+
from utils import *
|
4 |
+
from torch import nn
|
5 |
+
import lightning.pytorch as pl
|
6 |
+
from torch.nn import functional as F
|
7 |
+
|
8 |
+
device = 'cuda' if torch.cuda.is_available() else 'cpu'
|
9 |
+
|
10 |
+
demo = gr.Interface(
|
11 |
+
fn=generate_context,
|
12 |
+
inputs=[
|
13 |
+
gr.Textbox("Once Upon a Time ...", label="Enter Prompt to continue generation"),
|
14 |
+
gr.Slider(0.7, 1, value=0.8, label="Temperature", info="Parameter to controls the level of randomness in the sampling process . Higher values increases creativity",step=0.1),
|
15 |
+
gr.Slider(100, 300, value=200, label="Top K", info="Limit the response to K next predictions",step=50),
|
16 |
+
gr.Slider(10, 100, value=50, label="Max Tokens", info="Set value to get the output to max_values of tokens",step=10),
|
17 |
+
],
|
18 |
+
outputs="text",
|
19 |
+
examples = examples,
|
20 |
+
)
|
21 |
+
|
22 |
+
demo.launch()
|
requirements.txt
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
gradio
|
2 |
+
torch
|
3 |
+
torchvision
|
4 |
+
torchaudio
|
5 |
+
huggingface_hub
|
6 |
+
sentencepiece
|
7 |
+
tokenizers
|
8 |
+
lightning
|
9 |
+
fabric
|
10 |
+
jsonargparse
|