|
import sys |
|
import os |
|
import openai |
|
import gradio as gr |
|
|
|
|
|
|
|
openai.api_key = os.getenv('API_KEY') |
|
|
|
default_prompt = 'How to use ChatGPT?' |
|
|
|
|
|
def greet(name): |
|
return "ChatDulun is ChatGPT induced disruption to Higher Education \n" + name + "!!" |
|
|
|
|
|
|
|
|
|
with gr.Blocks() as demo: |
|
gr.HTML("""<h1 align="center">ChatDulun is Here to Disrupt Incumbent Workflow in HigherED</h1>""") |
|
with gr.Row().style(equal_height=True): |
|
name = gr.Textbox(label='What You Want ...').style(show_copy_button=True, container=True) |
|
output = gr.Textbox(label='What You Get ...') |
|
greet_btn = gr.Button("==> ChatGPT will complete ==>").style(size='lg') |
|
|
|
with gr.Accordion(label = "Are We Learning or Machine Learning ?", open = False): |
|
gr.Markdown("""![Robot](https://drclab-dulun-store.hf.space/img/ml.jpg)""") |
|
|
|
greet_btn.click(fn=greet, inputs=name, outputs=output) |
|
|
|
demo.title= 'ChatDulun = HigherEd Disrupted' |
|
demo.launch() |