agermanidis / gym-omegle

OpenAI Gym Environment for Omegle

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

gym-omegle

gym-omegle: An OpenAI Gym environment for Omegle

Defines an OpenAI Gym environment (omegle-v0) for training agents to chat with strangers on Omegle.

Uses Selenium with Chrome to perform the actions on the Omegle website.

Environment

Observation space: last message received by the stranger; each word is encoded using the GloVe algorithm trained on the Common Crawl corpus.

Action space: 98 actions in total; 95 actions for each of the printable ASCII characters, plus the following 3 actions:

  1. send current message

  2. clear current message

  3. wait for 1 second

Reward: 1 if the stranger has written a new message; 0 otherwise.

Installation

$ pip install .

Usage

import gym
import gym_omegle

class RandomAgent(object):
    """The world's simplest agent!"""
    def __init__(self, action_space):
        self.action_space = action_space

    def act(self, observation, reward, done):
        return self.action_space.sample()

env = gym.make("omegle-v0")
agent = RandomAgent(env.action_space)

reward = 0
done = False
episode_count = 3

for i in range(episode_count):
    ob = env.reset()
    while True:
        action = agent.act(ob, reward, done)
        ob, reward, done, _ = env.step(action)
        if done:
            break

env.close()

About

OpenAI Gym Environment for Omegle


Languages

Language:Python 100.0%