mafoaurelie
commited on
Commit
•
baf0d49
1
Parent(s):
1cde9ab
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
import transformers
|
3 |
+
from transformers import pipeline
|
4 |
+
generator=pipeline('text-generation',model='microsoft/phi-2')
|
5 |
+
generator('Hello i am an artificial intelligence engineer',max_length=40)
|
6 |
+
|
7 |
+
def Get_GenerationText(input_text):
|
8 |
+
result= generator(input_text)
|
9 |
+
return result[0]['generated_text']
|
10 |
+
|
11 |
+
iface=gr.Interface(fn=Get_GenerationText,
|
12 |
+
title='Generation Text',
|
13 |
+
inputs='text',
|
14 |
+
outputs='text',
|
15 |
+
description='Get Text Generation of giving input').launch()
|