Comments (5)
Hi @coolboyqu IIUC you could do something like this:
import gradio as gr
def update_state(request: gr.Request):
session_hash = request.session_hash
# do something with session_hash
return 123
with gr.Blocks() as demo:
s = gr.State()
demo.load(update_state, None, s) # at page load, s will store "123"
demo.launch()
if this does not answer your question, please provide more details and a code snippet that explains what you're trying to do. You can ask in this thread, or preferably, for general questions like this (that are not feature requests or bug reports), please ask in our Discord server. (I'll close this issue)
from gradio.
Hi @coolboyqu IIUC you could do something like this:
import gradio as gr def update_state(request: gr.Request): session_hash = request.session_hash # do something with session_hash return 123 with gr.Blocks() as demo: s = gr.State() demo.load(update_state, None, s) # at page load, s will store "123" demo.launch()if this does not answer your question, please provide more details and a code snippet that explains what you're trying to do. You can ask in this thread, or preferably, for general questions like this (that are not feature requests or bug reports), please ask in our Discord server. (I'll close this issue)
I'm sorry I didn't describe my problem clearly. What I meant was to find this session based on its unique identifier. For example, I recorded a row of data {cookie: 'abcde', session identifier: [1,2,3,4,5]} in the database. Before updating this database cookie to a new value, I would like to modify the State of several session operations with cookie 'abcde' based on [1,2,3,4,5]
from gradio.
Its still not clear to me, what is this "session identifier" here?
from gradio.
Its still not clear to me, what is this "session identifier" here?
Similar to session hash, a value which can uniquely mark the session.
from gradio.
Ok so I think my code snippet should provide a solution, right? You can access the session_hash and then look it up a db from within your function?
from gradio.
Related Issues (20)
- Exception in custom component templating from MultimodalTextbox HOT 1
- Tailwind support ? HOT 3
- Automatically infer the "type" parameter of components from Python type hints
- Named parameters for bash&curl requests?
- Add a way to more intuitively show and hide output cells HOT 1
- Forward custom authentication mechanism to httpx HOT 1
- mount_gradio_app auth_dependency parameter, how to redirect unauthenticated users?
- Gradio Interface not loading any local images HOT 1
- gradio_tools HOT 1
- an image select component HOT 1
- Unenable to use SadTalker Gradio WebUI on Kaggle HOT 3
- `bib` support in `Code` component HOT 9
- Automatic Cleanup of HuggingFaceDatasetSaver's local "flagged" directory HOT 1
- ChatInterface aditional params when open>close height of the chatbot goes more tall than the initial height
- File.select doesn't work anymore HOT 3
- Gradio-lite v4.38.1 fails to import PydanticV2 HOT 1
- ValueError: source code string cannot contain null bytes HOT 4
- Add the ability to switch between waveform display and the standard audio player. HOT 1
- Incorrect LaTeX formula display in gr.chatbot and gr.ChatInterface HOT 2
- Custom component dev server broke on windows HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gradio.