CoolFace
Apppublic

mnauf/redditGPT

sourceHugging Faceopenrailupdated 1y agoView on Hugging Face
0likes
app.py53 linesDownload Raw Back to root
1import gradio as gr2from sample import generate_text3 4badges = """5<div style="display: flex">6<span style="margin-right: 5px"> 7<a href="https://www.linkedin.com/in/mnauf/" target="_blank"> <img src="https://upload.wikimedia.org/wikipedia/commons/thumb/0/01/LinkedIn_Logo.svg/2560px-LinkedIn_Logo.svg.png" alt="Linkedin" width=100 height=auto> </a>8</span>9<span style="margin-right: 5px"> 10 <a href="https://github.com/mnauf/redditGPT" target="_blank"> <img src="https://img.shields.io/badge/github-%23121011.svg?style=for-the-badge&logo=github&logoColor=white" alt="Github"> </a>11</span>12<span style="margin-right: 5px"> 13 <a href="https://twitter.com/MNaufil" target="_blank"> <img src="https://img.shields.io/badge/Twitter-%231DA1F2.svg?style=for-the-badge&logo=Twitter&logoColor=white" alt="Twitter"> </a>14</span>15</div>16"""17 18description="""GPT2 finetuned on recent public anonymous conversations from Reddit to capture public sentiments regarding the recent unfolding events in Pakistan. Since the genaral public is afraid of speaking publicly with their identities exposed because of the crackdown, Reddit is the most genuine source we can get to understand the public sentiments. Data is collected from Pakistan, AskMiddleEast and WorldNews Reddit communities from last year until 25th May 2023."""19with gr.Blocks() as block:20    # gr.Markdown("""![Imgur](https://i.imgur.com/iPZlUa8.png)""")21    gr.HTML("<img src=https://i.imgur.com/iPZlUa8.png width=auto height=200>")22    gr.Markdown(badges)23    gr.Markdown(description)24    with gr.Row():25        input_text = gr.Textbox(26            label="Input Text",27            lines=1,28            value="Imran Khan arrest",29            elem_id="input_text"30        )31 32        output_text = gr.Textbox(33            label="Output",34            lines=10,35            value="",36            elem_id="input_text"37        )38 39    inputs = [input_text]40    outputs = [output_text]41 42    run_button = gr.Button(43        value="Generate Text",44    )45 46    run_button.click(47        fn=generate_text,48        inputs=inputs,49        outputs=outputs,50        queue=True51    )52# block.queue(concurrency_count=5).launch(server_name="localhost", share=True)53block.queue().launch()