EuroPython2022/cloudspace
1
1{2 "cells": [3 {4 "cell_type": "code",5 "execution_count": 1,6 "metadata": {},7 "outputs": [],8 "source": [9 "import gradio as gr"10 ]11 },12 {13 "cell_type": "code",14 "execution_count": 2,15 "metadata": {},16 "outputs": [],17 "source": [18 "def greet(name):\n",19 " return \"Hello \" + name + \"!!\""20 ]21 },22 {23 "cell_type": "code",24 "execution_count": 3,25 "metadata": {},26 "outputs": [27 {28 "name": "stdout",29 "output_type": "stream",30 "text": [31 "Running on local URL: http://127.0.0.1:7860/\n",32 "\n",33 "To create a public link, set `share=True` in `launch()`.\n"34 ]35 },36 {37 "data": {38 "text/html": [39 "<div><iframe src=\"http://127.0.0.1:7860/\" width=\"900\" height=\"500\" allow=\"autoplay; camera; microphone;\" frameborder=\"0\" allowfullscreen></iframe></div>"40 ],41 "text/plain": [42 "<IPython.core.display.HTML object>"43 ]44 },45 "metadata": {},46 "output_type": "display_data"47 },48 {49 "data": {50 "text/plain": [51 "(<gradio.routes.App at 0x128c99600>, 'http://127.0.0.1:7860/', None)"52 ]53 },54 "execution_count": 3,55 "metadata": {},56 "output_type": "execute_result"57 }58 ],59 "source": [60 "iface = gr.Interface(fn=greet, inputs=\"text\", outputs=\"text\")\n",61 "iface.launch()"62 ]63 },64 {65 "cell_type": "code",66 "execution_count": null,67 "metadata": {},68 "outputs": [],69 "source": []70 }71 ],72 "metadata": {73 "kernelspec": {74 "display_name": "Python 3.10.5 64-bit ('huggingface3.10.5')",75 "language": "python",76 "name": "python3"77 },78 "language_info": {79 "codemirror_mode": {80 "name": "ipython",81 "version": 382 },83 "file_extension": ".py",84 "mimetype": "text/x-python",85 "name": "python",86 "nbconvert_exporter": "python",87 "pygments_lexer": "ipython3",88 "version": "3.10.5"89 },90 "orig_nbformat": 4,91 "vscode": {92 "interpreter": {93 "hash": "5775e1b7401dce755d084640b8b677fb1753a7b539e898ee92e472188304b804"94 }95 }96 },97 "nbformat": 4,98 "nbformat_minor": 299}100 