Xhaheen commited on
Commit
a5cc8e4
1 Parent(s): 1dc2f71

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -10
app.py CHANGED
@@ -1,11 +1,9 @@
1
- import gradio as gr
 
2
 
3
- title = "facebook_OPT_350m_Language_model"
4
- description = "Gradio Demo for facebook_OPT_350m_Language_model , OPT was predominantly pretrained with English text, but a small amount of non-English data is still present within the training corpus via CommonCrawl. The model was pretrained using a causal language modeling (CLM) objective. OPT belongs to the same family of decoder-only models like GPT-3. As such, it was pretrained using the self-supervised causal language modedling objective. To use it, simply add your text, or click one of the examples to load them. Read more at the links below."
5
- article = "<p style='text-align: center'><a href='https://arxiv.org/abs/2205.01068' target='_blank'>OPT: Open Pre-trained Transformer Language Models</a></p>"
6
- examples = [
7
- ['life is like'],
8
- ["president of america is"],
9
- [" taj mahal is "]
10
- ]
11
- gr.Interface.load("huggingface/facebook/opt-125m", inputs=gr.inputs.Textbox(lines=5, label="Input Text"),title=title,description=description,article=article, examples=examples,enable_queue=True).launch()
 
1
+ import streamlit as st
2
+ from transformers import pipeline
3
 
4
+ generator = pipeline('text-generation', model="facebook/opt-125m")
5
+ prompt = st.text_area('Enter text below to generate new text using facebook_OPT_350m_Language_model')
6
+
7
+ if prompt:
8
+ out = generator(prompt)
9
+ st.json(out)